<?php
  include 'connect_to_database.php';
  connectToDatabase();
  
  session_start();
  $FIRSTNAME = $_SESSION['firstname'];
  $SURNAME   = $_SESSION['surname'];
  $EMAIL     = $_SESSION['email']; 
  $PASSWORD  = $_SESSION['password']; 
  $PASSWORD1 = $_SESSION['password1']; 
  
  if ( $PASSWORD != $PASSWORD1) {
  
    $_SESSION['passwordsmatch'] = False;
    }
  else
   {
     $my_query = mysql_query("SELECT * FROM Users WHERE Email = $EMAIL");
     if($my_query) { 
       $SQLINSERT = mysql_query("INSERT INTO Users (First_Name, Last_Name,
                                 Email, Password) VALUES
                                 ('$FIRSTNAME', '$SURNAME', '$EMAIL',
                                 '$PASSWORD')")
     
     } else { 
     
       $_SESSION['EmailExists'] = True

   }
 ?>
